#include "min_distance.h"

int main(int argc, char** argv) {
  
  ros::init(argc, argv, "min_distance_node");
  ros::NodeHandle n;

  std::string pkg_path,engine_name, engine_path;
  float conf_thresh, nms_thresh;
  
  n.getParam("pkg_path", pkg_path);
  n.param<std::string>("pkg_path", pkg_path, "/home/lin/ros_code/fusion_ws/src/ranging_detect/lidar2cam_fusion");

  n.getParam("engine_name", engine_name);
  n.param<std::string>("engine_name", engine_name, "x86-FP16-n.engine");
  n.getParam("conf_thresh", conf_thresh);
  n.param<float>("conf_thresh", conf_thresh, 0.25);
  n.getParam("nms_thresh", nms_thresh);
  n.param<float>("nms_thresh", nms_thresh, 0.45);

  engine_path = (pkg_path + "/weights/" + engine_name).c_str();

  std::cout << "\n---------------" << std::endl;
  std::cout << "pkg_path: " << pkg_path << std::endl;
  std::cout << "engine_name: " << engine_name << std::endl;
  std::cout << "engine_path: " << engine_path << std::endl;

  std::cout << "nms_thresh: " << nms_thresh << std::endl;
  std::cout << "conf_thresh: " << conf_thresh << std::endl;
  std::cout << "---------------\n" << std::endl;
  
  std::shared_ptr<MinDistance> min_dist = std::make_shared<MinDistance>(engine_path, conf_thresh, nms_thresh, n);
  ros::spin();
  return 0;
}